//
//  TTCoreValidity.m
//  Tint
//
//  Created by Kevin Wu on 2/22/12.
//  Copyright (c) 2012 Telligenty. All rights reserved.
//

#import "TTCoreValidity.h"


#pragma mark - Empty check

BOOL TTIsStringWithText(id object) {
    return object!=nil && 
    [object isKindOfClass:[NSString class]] && 
    ([(NSString *)object length] > 0);
}

BOOL TTIsDataWithBytes(id object) {
    return object!=nil && 
    [object isKindOfClass:[NSData class]] && 
    [(NSData *)object length] > 0;
}

BOOL TTIsArrayWithItems(id object) {
    return object!=nil && 
    [object isKindOfClass:[NSArray class]] && 
    ([(NSArray *)object count] > 0);
}

BOOL TTIsDictionaryWithItems(id object) {
    return object!=nil && 
    [object isKindOfClass:[NSDictionary class]] && 
    [(NSDictionary *)object count] > 0;
}

BOOL TTIsSetWithItems(id object) {
    return object!=nil && 
    [object isKindOfClass:[NSSet class]] && 
    [(NSSet *)object count] > 0;
}



#pragma mark - Validity

BOOL TTIsInstance(id object, Class cls) {
    return (object!=nil && [object isKindOfClass:cls]);
}

